package com.atguigu.yygh.enums;

/**
 * 枚举类
 */
public enum StatusEnum {
    //创建枚举项
    NORMAL(1,"正常"),
    LOCK(0,"锁定")
    ;

    private Integer code;
    private String desc;
    public void setCode(Integer code) {
        this.code = code;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    public Integer getCode() {
        return code;
    }
    public String getDesc() {
        return desc;
    }
    StatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getDescByCode(Integer code){
        StatusEnum[] values = StatusEnum.values();
        for (StatusEnum value : values) {
            if(value.getCode().intValue()==code.intValue()){
                return value.getDesc();
            }
        }
        return "";
    }

}